/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package 解析.node.charproperty.支持补集;

/**
 *
 * @author yanxi
 */
public class Block extends CharProperty支持补集 {
    public String name="";
    public final Character.UnicodeBlock block;

    public Block(String name,Character.UnicodeBlock block) { 
        this.block = block; 
        this.name=name;
    } 

    @Override
    public boolean isSatisfiedBy正集(int ch) {
        return block == Character.UnicodeBlock.of(ch);
    }

    @Override
    public String toString正集() {
        if(name.equals("In"))return "\\p{In"+block+"}";
        else return "\\p{"+name+"="+block+"}";
    }

    @Override
    public String toString补集() {
        if(name.equals("In"))return "\\P{In"+block+"}";
        else return "\\P{"+name+"="+block+"}";
    }
}
